import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';

class Header extends Component {
  back = () => {
    this.props.history.goBack();
  }

  forward = () => {
    this.props.history.goForward();
  }

  render() {
    return (
      <div>
        <h3>I am Component Home</h3>
        <button onClick={this.back}>后退</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button onClick={this.forward}>前进</button> <br /><br />
      </div>
    )
  }
}

export default withRouter(Header);
